﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:local="clr-namespace:ESRI.ArcGIS.Client.Toolkit"
	xmlns:primitives="clr-namespace:ESRI.ArcGIS.Client.Toolkit.Primitives">

	<Style TargetType="local:InfoWindow">
		<Setter Property="Background" Value="White" />
		<Setter Property="BorderBrush" Value="Black" />
		<Setter Property="HorizontalAlignment" Value="Left" />
		<Setter Property="VerticalAlignment" Value="Top" />
		<Setter Property="Padding" Value="0" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="local:InfoWindow">
					<Grid x:Name="Root" RenderTransformOrigin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=RenderTransformOrigin}">
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Show">
									<Storyboard>
										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="Root">
											<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1">
												<EasingDoubleKeyFrame.EasingFunction>
													<BackEase EasingMode="EaseOut" Amplitude=".5"/>
												</EasingDoubleKeyFrame.EasingFunction>
											</EasingDoubleKeyFrame>
										</DoubleAnimationUsingKeyFrames>
										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" Storyboard.TargetName="Root">
											<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1">
												<EasingDoubleKeyFrame.EasingFunction>
													<BackEase EasingMode="EaseOut" Amplitude=".5"/>
												</EasingDoubleKeyFrame.EasingFunction>
											</EasingDoubleKeyFrame>
										</DoubleAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="Hide">
									<Storyboard>
										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="Root">
											<EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0">
												<EasingDoubleKeyFrame.EasingFunction>
													<CircleEase EasingMode="EaseIn" />
												</EasingDoubleKeyFrame.EasingFunction>
											</EasingDoubleKeyFrame>
										</DoubleAnimationUsingKeyFrames>
										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" Storyboard.TargetName="Root">
											<EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0">
												<EasingDoubleKeyFrame.EasingFunction>
													<CircleEase EasingMode="EaseIn" />
												</EasingDoubleKeyFrame.EasingFunction>
											</EasingDoubleKeyFrame>
										</DoubleAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Grid.RenderTransform>
							<ScaleTransform ScaleX="0" ScaleY="0" />
						</Grid.RenderTransform>

						<Path x:Name="BorderPath" StrokeLineJoin="Round" 
								Fill="{TemplateBinding Background}" 
								Stroke="{TemplateBinding BorderBrush}" 
								StrokeThickness="{TemplateBinding StrokeThickness}" 
								/>

							<ContentPresenter
										  ContentTemplate="{TemplateBinding ContentTemplate}"
										  Content="{TemplateBinding Content}"
										  Margin="{TemplateBinding Padding}" />

					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>